package com.xlf.config;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import org.springdoc.core.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Knife4j配置类
 */

@Configuration
public class Knife4jConfig {

    @Bean
    public GroupedOpenApi adminApi() {
        return GroupedOpenApi.builder()
                .group("管理端API")
                .packagesToScan("com.xlf.controller.admin")
                .pathsToMatch("/**")
                .build();
    }

    @Bean
    public GroupedOpenApi clientApi() {
        return GroupedOpenApi.builder()
                .group("微信小程序端API")
                .packagesToScan("com.xlf.controller.client")
                .pathsToMatch("/**")
                .build();
    }

    @Bean
    public OpenAPI customOpenAPI() {
        return new OpenAPI()
                .info(new Info()
                        .title("来一杯吧系统API文档")
                        .version("2.0")
                        .description("来一杯吧系统前后端接口文档")
                        .contact(new Contact().name("KZZuiFeng").email("L1758781031@outlook.com")))
                .externalDocs(new ExternalDocumentation()
                        .description("项目文档")
                        .url("https://gitee.com/kzzuifeng/lets-have-a-drink"));
    }
}